<template>
	<view :class="'video-boxs ' + (isMine ? 'my-video' : '')" @click="playerHander" >
		<video class="videos" :src="message.payload.remoteVideoUrl" object-fit="fill"></video>
		<!-- <image class="video-icon" src="../../../../static/images/video-play.png"></image> -->
	</view>
</template>

<script>
// import videoIcon from '../../../../static/images/video-play.png';
export default {
	data() {
		return {
			isPlay: false,
			// videoIcon: videoIcon
			videoIcon:''
		};
	},

	components: {},
	props: {
		message: {
			type: Object,
			default: () => {}
		},
		isMine: {
			type: Boolean,
			default: true
		}
	},
	watch: {
		message: {
			handler: function(newVal) {
				this.message=newVal
			},
			immediate: true,
			deep: true
		}
	},
	methods: {
		detate(e){
			// 主动撤回消息
			console.log(e)
			return
			let promise = uni.$TUIKit.revokeMessage(this.message);
			promise.then(function(imResponse) {
			  // 消息撤回成功
			}).catch(function(imError) {
			  // 消息撤回失败
			  console.warn('revokeMessage error:', imError);
			});
		},
		playerHander() {
			console.log(this.message); 
			// let promise = uni.$TUIKit.revokeMessage(this.message);
			// promise.then(function(imResponse) {
			//   // 删除消息成功
			// }).catch(function(imError) {
			//   // 删除消息失败
			//   console.warn('revokeMessage error:', imError);
			// });

			// let promise = uni.$TUIKit.revokeMessage(this.message);
			// promise.then(function(imResponse) {
			//   // 消息撤回成功
			//   console.log(imResponse)
			// }).catch(function(imError) {
			//   // 消息撤回失败
			//   console.warn('revokeMessage error:', imError);
			// });
			uni.$emit('videoPlayerHandler', {
				isPlay: true,
				message: this.message
			});
		},
		stopHander() {
			this.isPlay = false;
		}
	}
};
</script>
<style>
@import './index.css';
</style>
